<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>规则检查审核</title>
<%@ include file="/common/meta.jsp"%>
<script type="text/javascript"
	src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript"
	src="${res}/js/keyword/keywordtips.js"></script>	
<script type="text/javascript">
var prcWin = new progressWin("${res}");//初始化遮罩层

$(document).ready(function(){
	$("#submit").click(function(){
		if(check()){
			var status = $("#status").val();
			var opn = $("#opinion").val();
			if(opn==null||opn==""){
				opn = $("#opinion").text();
			}
			var options = {
					beforeSubmit : function() {
						$("#submit").attr("disabled",true);
						prcWin.openWin();//打开遮罩层
					}, // 表单提交前的回调函数
					success : function(data) {
						prcWin.closeWin();
						if(data="success"){
							scmSuccess("操作成功！");
							parent.irisGrid.getGridDom().jqGrid("refresh",0);//0是本页1是首页
							parent.parent.irisGrid.getGridDom().jqGrid("refresh",0);//0是本页1是首页
							//parent.currefresh=false;
							window.setTimeout("parent.tb_remove()", 2000);
						}else{
							scmWarn("操作失败！");
						}
					
					},// 表单成功提交后的回调函数
					error : function() {
						scmError("操作失败,请联系系统管理员！");
						prcWin.closeWin();
					},
					url: "${ctx}/prpapprove/set-fit-status"
				};
			  $("#mainForm").ajaxSubmit(options);			
		}
	});
	
	$("#close").click(function(){
		parent.tb_remove();
	});
	
	setStatusValue("init");
});

function check(){
	$("#check_status_value").val($("input[name='check_status']:checked").val());
	validate($("#mainForm"),"");
	if(!valResult()){
		irisValShowMsg($("#wbox1"));
		$("#myMap").attr("width","50");
		return false;
	}
	return true;
}

//op不为空表示页面加载时调用，初始化radio；为空表示是radio事件
function setStatusValue(op){
	if(op){
		var statusVal = "${checkResult.status}";
		$("input[name='check_status']").each(function(){
			if($(this).val() == statusVal){
				$(this).attr("checked",true);
			}
		});
	}else{
		$("input[name='check_status']").each(function(){
			if($(this).attr("checked")){
				$("#status").val($(this).val());
			}
		});
	}
}
</script>
<style type="text/css">
 #myMap{
    width:200px;
 }
</style>
</head>
<body>
	<form method="post" id="mainForm">
		<input type="hidden" name="prpCode" value="${param.prpCode}" />
		<input type="hidden" name="ruleCode" value="${param.ruleCode}" />
		<input type="hidden" name="status" value="${checkResult.status}" id="status"/>
		<span class="color_red" >*</span>结论： <input type="radio" name="check_status" id="status_0" value="0" onchange="setStatusValue();" >符合&nbsp;
		      <input type="radio" name="check_status" id="status_1" value="1" onchange="setStatusValue();" >不符合
		      <input type="hidden" id="check_status_value" name="check_status_value" class="required" label="结论">
		<div class="clear_h10"></div>
		<span class="color_red">*</span>意见（限500字）：
		<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="1">
	        <tr class="li_1">
	          <td width="100%"><textarea name="opinion" id="opinion" style="width:100%" rows="10" class="required  maxlength:500" label="意见">${checkResult.confirmRemark}</textarea></td>
	        </tr>
      	</table>
      	<br/>
      <div style="text-align: center;">
      	&nbsp;<input type="button" class="button_01" value="提交" id="submit"/>
      	&nbsp;<input type="button" class="button_01" value="关闭" id="close"/>
	  </div>
	</form>
</body>
</html>